<template>
<div>
  <div>{{msg}}</div>
  <div>{{foo}}</div>
  <div>{{ob}}</div>
</div>
</template>

<script>
import { defineComponent, inject,ref } from "vue";

const sleep = (t)=>new Promise(resolve=>setTimeout(resolve,t))

export default defineComponent({
  async setup(){ 
    const msg = ref('msg')
    const foo = inject('foo','defaultfoo')
    await sleep(2000)
    const ob = inject('ob')
    return {
      msg,
      foo,
      ob
    }
  }
})
</script>